68125c
@@ -34,12 +34,12 @@
 import java.sql.Statement;
 import java.sql.Struct;
 import java.util.HashMap;
-import java.util.concurrent.Executor;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
+import java.util.concurrent.Executor;
 
 import javax.security.sasl.Sasl;
 import javax.security.sasl.SaslException;
@@ -124,6 +124,12 @@
private void configureConnection(Utils.JdbcConnectionParams connParams)
         stmt.execute("set " + hiveConf.getKey() + "=" + hiveConf.getValue());
         stmt.close();
       }
+
+      // For remote JDBC client, try to set the hive var using 'set hivevar:key=value'
+      for (Entry<String, String> hiveVar : connParams.getHiveVars().entrySet()) {
+        stmt.execute("set hivevar:" + hiveVar.getKey() + "=" + hiveVar.getValue());
+        stmt.close();
+      }
     }
   }
 
